package offerv1;

import java.util.Arrays;

public class Offer45 {
    //45 vs 67=>4567
    //30 vs 3=>303
    //330 vs 34=>303
    //0 vs 99=>990 特殊处理
    public String minNumber(int[] nums) {
        String[] strs = new String[nums.length];
        for(int i = 0; i < nums.length; i++)
            strs[i] = String.valueOf(nums[i]);
        Arrays.sort(strs, (x, y) -> (x + y).compareTo(y + x));//强！！！ 加法关键
        StringBuilder res = new StringBuilder();
        for(String s : strs)
            res.append(s);
        return res.toString();
    }
}
